package src.org.microblog.dao;

import org.apache.ibatis.annotations.Param;
import src.org.microblog.entity.Blog;

import java.sql.SQLException;
import java.util.List;

public interface BlogDao {
    //统计我的微博数
    public int getBlogCount(@Param("uId") int uId) throws SQLException;
    //跟据博客Id获取博客的转发数目
    public int getForwardCountByBid(@Param("bid") int bid) throws SQLException;
    //根据博客Id获取博客明细
    public Blog findBlogById(@Param("id") int id) throws SQLException;
    //删除一条微博
    public int deleteBlog(@Param("id") int id) throws SQLException;
    //统计我和我的关注人的微博总数
    public int getAllBlogsCount(@Param("uId") int uId, @Param("keyword") String keyword) throws SQLException;
    //分页获取我和我的关注人的微博
    public List<Blog> getAllBlogsByPage(@Param("uId") int uId, @Param("keyword") String keyword, @Param("pageNo") int pageNo, @Param("pageSize") int pageSize) throws SQLException;
    //发布微博
    public int addNewBlog(Blog blog) throws SQLException;
    //统计微博总数
    public int getPopBlogsCount(@Param("uId") int uId, @Param("keyword") String keyword) throws SQLException;
    //分页查询热门微博列表
    public List<Blog> getPopBlogsByPage(@Param("uId") int uId, @Param("keyword") String keyword, @Param("pageNo") int pageNo, @Param("pageSize") int pageSize) throws SQLException;
    //根据查询关键字统计用户微博数
    public int getBlogCountByUidAndKeyword(@Param("uId") int uId, @Param("keyword") String keyword) throws SQLException;
    //分页获取我的微博列表
    public List<Blog> getMyBlogsByPage(@Param("uId") int uId, @Param("keyword") String keyword, @Param("pageNo") int pageNo, @Param("pageSize") int pageSize) throws SQLException;
    //转发微博
    public int forwardBlog(@Param("uId") int uId, @Param("content") String content, @Param("fromBid") int fromBid) throws SQLException;
}
